Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Map] Introduce ux_map.google_maps.default_map_id configuration #2350

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from

Conversation

Kocal
Copy link
Member

@Kocal Kocal commented Nov 7, 2024

Q A
Bug fix? no
New feature? yes
Issues Fix #2306
License MIT

With this modification, I can configure a default Google Maps mapId:

# config/packages/ux_map.yaml
ux_map:
    # https://symfony.com/bundles/ux-map/current/index.html#available-renderers
    renderer: '%env(resolve:default::UX_MAP_DSN)%'
    google_maps:
        default_map_id: abcdefgh123456789

without having to manually pass the mapId when creating a Map:

// use default mapId
$map = (new Map());
    ->center(new Point(48.8566, 2.3522))
    ->zoom(6);

// use default mapId
$map2 = (clone $map)
    ->options(new GoogleOptions());

// use custom mapId
$map3 = (clone $map)
    ->options(new GoogleOptions(mapId: 'foobar));

@carsonbot carsonbot added Feature New Feature Map Status: Needs Review Needs to be reviewed labels Nov 7, 2024
Comment on lines +84 to +90
->set($rendererFactoryName = 'ux_map.renderer_factory.'.$name, $bridge['renderer_factory'])
->parent('ux_map.renderer_factory.abstract')
->tag('ux_map.renderer_factory');

if ('google' === $name) {
$container->services()
->get($rendererFactoryName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of variables in service names (just personal taste here)

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New Feature Map Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Map] Google map ID config when using a marker
3 participants